﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OrandoLabs.OpenSource.Cojecto;

namespace CojectBulkLoaderCommand
{
    class Program
    {
        static void Main(string[] args)
        {
            int iter = 500000;
            String instance = args[0];
            String dir = args[1];
            String uri = args[2];
            String triplesDir = Path.Combine(dir, "triples");
            String instanceDir = Path.Combine(dir, instance);

            CojectoBulkFolderLoader loader = new CojectoBulkFolderLoader(instance, instanceDir, triplesDir, uri);
            Task<bool> loaded = loader.Load((String file, bool begin) =>
            {
                if (begin)
                    Console.WriteLine("Start: " + file);
                else
                    Console.WriteLine("End: " + file);
                return true;
            },
            (long current, long total) =>
            {
                if (current % iter == 0 || total % iter == 0)
                {
                    Console.Write("Current: " + current.ToString("#,##0"));
                    Console.WriteLine(", Total: " + total.ToString("#,##0"));

                } return true;
            }
            );
            loaded.Wait();
        }
    }
}
